﻿CREATE VIEW dbo.vw_DisplayActiveAlerts
AS
SELECT     FE.MeterNumber, FE.MeterVendorID, FE.MeterHeadEndID, FE.TimeStamp, FE.Temp, FE.Code, FE.Status, L.addr_line2, L.addr_state, L.addr_city, L.addr_zip, L.latitude, 
                      L.longitude
FROM         dbo.FilteredEvents AS FE INNER JOIN
                      dbo.Meters AS M ON FE.MeterNumber = M.MeterNumber INNER JOIN
                      dbo.Location AS L ON M.MeterID = L.MeterID
WHERE     (L.latitude <> 0) AND (L.longitude <> 0) AND (FE.Status = 'Active')